<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>My Vue App</title>
  <link rel="stylesheet" href="./vue-rels/element-ui.css">
  <script src="./vue-rels/vue2.js"></script>
  <!--必须在vue2.js后引入element-ui.js -->
  <script src="./vue-rels/element-ui.js"></script>
  <script src="api.js"></script>
  <!-- <script src="sub_table_component.js"></script> -->
  <style>
    
  </style>
</head>
<body>
  <div id="app">
    {{ message }}
    {{xx}}
    <!-- <table border="1" width="30%" style="border-collapse: collapse;">
        <tr v-for="item in tabledata">
            <td>  <input type="text" v-model="item.hospitalName" placeholder="请输入内容..."></td>
            <td> <input type="text" v-model="item.hospitalType" placeholder="请输入内容..."></td>
            <td>{{item.hospitalLevel}}</td>
            <td>{{item.legalPerson}}</td>
        </tr>
    </table> -->

    <!--子表格组件-->
    <!-- <subtable :tabledata="tabledata"></subtable> -->
  <el-table :data="tableData" style="width: fit-content" >
    <el-table-column prop="hospitalName" label="名称" width="180" style="background-color: aquamarine;"> </el-table-column>
    <el-table-column label="其他信息">
        <el-table-column prop="hospitalType" label="类型" width="180"> 
            <template slot-scope="scope">
                 <input
                    v-model="scope.row.hospitalType"
                    placeholder=""
                    placeholder-class="input-placeholder"
                 />   
            </template>    
        </el-table-column>
        <el-table-column prop="hospitalLevel" label="级别" width="180"> </el-table-column>
        <el-table-column prop="legalPerson" label="法人" width="180"> </el-table-column>
    </el-table-column>
    <el-table-column label="其他信息2">
        <el-table-column prop="legalPerson" label="法人2" width="180"> </el-table-column>
        <el-table-column prop="legalPerson" label="法人3" width="180"> </el-table-column>
    </el-table-column>    
    <el-table-column v-if="pageMode=='edit'" label="操作" width="180">
        <template slot-scope="scope">
          <el-button
            size="mini"
            type="danger"
            @click="handleDelete(scope.$index, scope.row)">删除</el-button>
        </template>
      </el-table-column>

  </el-table>


    <el-row>
        <el-button>默认按钮</el-button>
        <el-button type="primary">主要按钮</el-button>
        <el-button type="success">成功按钮</el-button>
        <el-button type="info">信息按钮</el-button>
        <el-button type="warning">警告按钮</el-button>
        <el-button type="danger">危险按钮</el-button>
    </el-row>


    <div>
        <button @click="submitData()">按钮</button>
    </div>
  </div>

  <script>
    // 申明子表格组件
    //var subTableComponent=getSubTableComponent(["名称","类型","级别","法人"],["hospitalName","hospitalType","hospitalLevel","legalPerson"],true)
    // var tabledata=function(){
    //     return [{hospitalName:"A",hospitalType:"B",hospitalLevel:"1",legalPerson:"s"}]
    // }

    //构建vue实例
    var app = new Vue({
      el: '#app',
      data:function() {
        return {
        pageMode:"read",    
        message: 'Hello Vue!',
        xx:'',
        tableData:[{hospitalName:"A",hospitalType:"B",hospitalLevel:"1",legalPerson:"s"}]
      }
    }
    //   components:{
    //     "el-table":eltable
    //   }
    });

    //异步初始化数据
    getTableData('共通表格查询',{},function(data){app.tableData=data.data});

    //提交变更数据
    function submitData(){
        submitChangeData('共通表格编辑',{data:app.tableData},function(data){
            console.log("rs",data)
            if(data.code==0){
                alert('提交成功');
            }else{
                alert('提交失败');
            }
        })
    }     
  </script>
</body>
</html>